@extends('Admin.layouts.common')

@section('content')
    <div class="container myContainer">
        <?php /*?>
        <button class="btn btn-info searchBtn" onclick="$('.search_box').slideToggle();">搜索/筛选</button>
        
        <div class="search_box">
            <form id="search_form" method="GET">
                <label>
                    标题：<br>
                    <input name="key" type="text" class="form-control search_form_control" value="{{ $_search['key'] }}">
                </label>
                <label>
                    分类：<br>
                    <select name="type" class="form-control search_form_control">
                        <option value="">全部</option>
                        @foreach($cats as $cat_id=>$item)
                        <option value="{{$cat_id}}" @if($_search['type']==$cat_id) selected="" @endif>{{$item->name}}</option>
                        @endforeach
                    </select>
                </label>
                <button class="btn btn-primary" type="submit">&nbsp;&nbsp;确定&nbsp;&nbsp;</button>
            </form>
        </div>
        <?php */?>
        <div class="table-responsive">
            <div id="container" style="min-width:400px;height:400px"></div>
            <div id="container1" style="min-width:400px;height:400px"></div>
        </div>
    </div>
@endsection

@section('foot')
<script src="https://cdn.hcharts.cn/highcharts/highcharts.js"></script>



<script type="text/javascript">
$.ajaxSetup({
    headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
})

var chart = Highcharts.chart('container', {
    chart: {
        type: 'line'
    },
    title: {
        text: '各分类文章采集数'
    },
    subtitle: {
        text: '数据来源: 松鼠'
    },
    xAxis: {
        categories: [
            @foreach($days as $day)
            {{$day}},
            @endforeach
        ]
    },
    yAxis: {
        title: {
            text: '条数'
        }
    },
    plotOptions: {
        line: {
            dataLabels: {
                // 开启数据标签
                enabled: true          
            },
            // 关闭鼠标跟踪，对应的提示框、点击事件会失效
            enableMouseTracking: false
        }
    },
    series: [
        @foreach($data as $item)
        {
            name: '{{$item['name']}}',
            data: [
                @foreach($item['data']['collection'] as $value)
                    {{$value}},
                @endforeach
            ]
        },
        @endforeach
    ]
});



var chart = Highcharts.chart('container1', {
    chart: {
        type: 'line'
    },
    title: {
        text: '各分类文章采集入库数'
    },
    subtitle: {
        text: '数据来源: 松鼠'
    },
    xAxis: {
        categories: [
            @foreach($days as $day)
            {{$day}},
            @endforeach
        ]
    },
    yAxis: {
        title: {
            text: '条数'
        }
    },
    plotOptions: {
        line: {
            dataLabels: {
                // 开启数据标签
                enabled: true          
            },
            // 关闭鼠标跟踪，对应的提示框、点击事件会失效
            enableMouseTracking: false
        }
    },
    series: [
        @foreach($data as $item)
        {
            name: '{{$item['name']}}',
            data: [
                @foreach($item['data']['insert'] as $value)
                    {{$value}},
                @endforeach
            ]
        },
        @endforeach
    ]
});
</script>
@endsection